<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>订单详情-交易关闭</title>
		<meta name="author" content="CHAO">
		<meta name="description" content="普济">
		<meta name="viewport" content="initial-scale=1,maximum-scale=1">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="transparent">
		<meta name="format-detection" content="telephone=no,email=no">
		<link rel="stylesheet" type="text/css" href="../../css/base.css" />
		<link rel="stylesheet" type="text/css" href="../../css/layer.css" />
		<link rel="stylesheet" type="text/css" href="../../css/order/order_details.css?v=1.0.1" />
	</head>

	<body>
		<!--头部-->
		<div class="g_top">
			<img class="g_back" src="../../img/b_back.png" />
			<span id="g_title">订单详情</span>
			<span id="lianxilietou">联系团队</span>
		</div>
		<div class="zhuangtai">
			<p>交易关闭</p>
			<img class="img_1" src="../../img/b_ddxq_11.png" />
		</div>
		<div class="order_address">
			<img class="img_2" src="../../img/b_ddxq_18.png" />
			<div class="address_main">
				<!--<p class="order_people">
					<span class="order_name">收货人: 丽丽</span>
					<span class="order_phone">12452451564</span>
				</p>
				<p class="address_xq">
					收货地址: <span class="sheng">北京</span><span class="shi">北京市</span>
					<span class="xian">朝阳区</span><span class="jiedao">麦子街西路</span>
					<span class="zhuzhi">嘉里大通中心401</span>
				</p>-->
			</div>
		</div>
		<div class="thing_mian">
			<p class="p_1">商品信息</p>
			<div class="shop_xq">
				<!--<div class="shop_thing">
					<div class="thing_img">
						<img src="../../img/b_1_23.png"/>						
					</div>
					<dl class="thing_xq">
						<dt class="thing_title">文艺简约大大阿萨斯大大大阿算</dt>
						<dd class="thing_guige">贩卖梦境/100g</dd>
					</dl>
					<div class="thing_shuliang">
						<p class="thing_danjia">¥1233.00</p>
						<p class="thing_num">×3</p>	
					</div>	
				</div>
				<div class="shop_thing">
					<div class="thing_img">
						<img src="../../img/b_1_23.png"/>						
					</div>
					<dl class="thing_xq">
						<dt class="thing_title">文艺简约大大阿萨斯大大大阿算</dt>
						<dd class="thing_guige">贩卖梦境/100g</dd>
					</dl>
					<div class="thing_shuliang">
						<p class="thing_danjia">¥1233.00</p>
						<p class="thing_num">×3</p>	
					</div>	
				</div>
				<div class="shop_thing">
					<div class="thing_img">
						<img src="../../img/b_1_23.png"/>						
					</div>
					<dl class="thing_xq">
						<dt class="thing_title">文艺简约大大阿萨斯大大大阿算</dt>
						<dd class="thing_guige">贩卖梦境/100g</dd>
					</dl>
					<div class="thing_shuliang">
						<p class="thing_danjia">¥1233.00</p>
						<p class="thing_num">×3</p>	
					</div>	
				</div>-->
			</div>
		</div>
		<div class="order_xinxi">
			<p class="p_1">订单信息</p>
			<div id="xinxi_main">
				<!--<p class="thing_heji"><span>商品合计:</span><span>¥198.00</span></p>
				<p class="yunfei"><span>运费:</span><span>¥0.00</span></p>
				<p class="youhuiquan"><span>优惠券:</span><span>¥0.00</span></p>
				<p class="houdongyouhui"><span>活动优惠:</span><span>-¥8.00</span></p>-->
			</div>
		</div>
		<div class="order_zhifu">
			<div id="order_zhifu">
				<!--<p><span>订单编号:</span><span id="dingDanNum" class="js-copy" data-clipboard-text="1213556154613565163">1234567894646<span id="order_copy">复制</span></span></p>
				<p><span>商品类型:</span><span>砍价商品</span></p>
				<p><span>提交时间:</span><span>2018-01-18 20:32:09</span></p>
				<p><span>支付方式:</span><span>在线支付</span></p>				-->
			</div>
		</div>
		<div class="order_delete">
			<p id="order_delete">删除订单</p>
		</div>
	</body>
	<script src="../../js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/clipboard.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/layer.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		if(Auth()) {
			var dataObj = {
				//			phone: 15011552665,
				//			uuid: "09d34ce877a14ce7a5411c6529b99484",
				uuid: user_info.uuid,
				phone: user_info.phone
			}
			if(globalFun.GetQueryString('orderNo')){
				dataObj.orderNo = globalFun.GetQueryString('orderNo')
			}else{
				dataObj.orderNo = localStorage.getItem('orderNo')
			}
		}else{
			if (mark===1) {
			    setupWebViewJavascriptBridge(function(bridge){
			        bridge.callHandler('jsToClientLogin',type,function(resp){});
			    });
			} else if (mark===0) {
			    window.stub.jsToClientLogin();
			}
		}
		$.ajax({
			type: "post",
			url: apicom + "/mobile/after/order/queryOrderDetails",
			data: dataObj,
			success: function(res) {
				if(typeof(res) == "String") {
					var data = JSON.parse(res).content;
				} else {
					var data = res.content
				}
				console.log(data)
				if(data.merchantId==null){
					$("#lianxilietou").html('联系团队')
				}else{
					$("#lianxilietou").html('联系团队')
				}
				//收货地址联系人
				$("<p class='order_people'><span class='order_name'>收货人: " + data.receiveName +
					"</span><span class='order_phone'>" + data.receivePhone + "</span></p><p class='address_xq'>收货地址: " + data.receiveAddress + "</span></p>").appendTo($('.address_main'));

				//订单商品
				var producType;
				for(var i = 0; i < data.productList.length; i++) {
					$("<div class='shop_thing'><div class='thing_img'><img src='" + data.productList[i].address + "'/></div><dl class='thing_xq'><dt class='thing_title'>" + data.productList[i].name + "</dt><dd class='thing_guige'>" + data.productList[i].productSpecificationName +
						"</dd></dl><div class='thing_shuliang'><p class='thing_danjia'>¥" + data.productList[i].sPrice + "</p><p class='thing_num'>×" + data.productList[i].num + "</p></div></div>").appendTo($('.shop_xq'));
					producType = data.productList[0].productType
				};

				//订单价钱
				$("<p class='thing_heji'><span>商品合计:</span><span>¥" + data.orderSumPrice + "</span></p><p class='yunfei'><span>运费:</span><span>¥" + data.orderFreight + "</span></p>").appendTo($('#xinxi_main'));

				//订单详细信息
				$("<p><span>订单编号:</span><span id='dingDanNum' class='js-copy' data-clipboard-text='" + data.orderNo + "'>" + data.orderNo + "<span id='order_copy'>复制</span></span></p><p><span>商品类型:</span><span>"+producType+"</span></p><p><span>提交时间:</span><span>" + data.createTime + "</span></p><p><span>支付方式:</span><span>" + data.payType + "</span></p>").appendTo($('#order_zhifu'));

				//复制单号
				var btn1 = document.getElementById('dingDanNum');
				var clipboard = new Clipboard(btn1); //实例化	
				//复制成功执行的回调，可选
				clipboard.on('success', function(e) {
					tips('复制完成');
				});
				//复制失败执行的回调，可选
				clipboard.on('error', function(e) {
					tips('请再试一次');
				});
				//联系猎头
				$("#lianxilietou").on('click', function() {
					var lx = data.orderNo;
					var lt = data.merchantId;
					if(lt==null){
						lt = "null"
					}
					var ltuu = data.merchantUuid;
					var ltnicheng = localStorage.getItem('nickName');
					var merchantImg = localStorage.getItem('merchantImg');
					var ptimg = data.serverImg
					var ptuu = data.serverUuid
					var ptnicheng = data.serverNickName	
						var datalianxi = {
							merchantId: lt,
							orderNo: lx,
							phone: user_info.phone,
							uuid: user_info.uuid,
							data: '32' //联系猎头
						}
					if(lt=="null"){
						datalianxi.userId = ptuu;
						datalianxi.Img = ptimg;
						datalianxi.nickName =  ptnicheng
					}else{
						datalianxi.userId = ltuu;
						datalianxi.Img = merchantImg;
						datalianxi.nickName =  ltnicheng
					}
					console.log(datalianxi)
					// var jiaoHu = JSON.stringify(datalianxi)
					TiaoZhuan(datalianxi)
				})

			},
			error: function(err) {
				console.log(err)
			}
		});

		//删除订单
		if(Auth()) {
			var deleteObj = {
				//			uuid: "09d34ce877a14ce7a5411c6529b99484",
				//			phone: 15011552665,
				uuid: user_info.uuid,
				phone: user_info.phone,
				type: 1, //会员
				orderNo: localStorage.getItem('orderNo')
			}
				if(globalFun.GetQueryString('orderNo')){
					deleteObj.orderNo = globalFun.GetQueryString('orderNo')
				}else{
					deleteObj.orderNo = localStorage.getItem('orderNo')
				}
		}

		$('#order_delete').on('click', function() {
			$.ajax({
				type: "POST",
				url: apicom + "/mobile/after/order/deleteOrderByMember",
				data: deleteObj,
				success: function(res) {
					if(typeof(res) == "String") {
						var data1 = JSON.parse(res);
					} else {
						var data1 = res
					}
					console.log(data1)
					if(data1.code == 1) {
						//					$(this).parents('.all_order').remove();
						tips('删除成功');
						window.location.href = rootdomain + "html/order/my_order.html?status=8"
					}
				},
				error: function(err) {
					tips('请刷新重试');
				}
			})
		})

		//返回
		$('.g_back').on('click', function() {
			if(globalFun.GetQueryString('orderNo')){
				fanhui()
			}else{
				window.history.go(-1)
			}	
		})
		
		function fanhui(data) {
			var ua = navigator.userAgent.toLowerCase();
			if(/pjyc_i/.test(ua)) {
				setupWebViewJavascriptBridge(function(bridge) {
					bridge.callHandler('goBack', data, function(resp) {});
				});
			} else if(/pujiyicheng/.test(ua)) {
				//var result = lase;
				window.stub.goBack(); //用接口stub, 通过调用内部类中的方法jsMethod给java传回result。

			}
		}
		
function TiaoZhuan(data) {
	var ua = navigator.userAgent.toLowerCase();
	if(/pjyc_i/.test(ua)) {
		setupWebViewJavascriptBridge(function(bridge) {
			bridge.callHandler('jsToClientMine', data, function(resp) {});
		});
	} else if(/pujiyicheng/.test(ua)) {
		var data1 = JSON.stringify(data);
		//var result = lase;
		window.stub.jsToClientAfterSale(data1); //用接口stub, 通过调用内部类中的方法jsMethod给java传回result。

	}
}
	</script>

</html>